<template>
    <Menu />
    <webview style="height: calc(100% - 70px);" src="https://jc.pep.com.cn/"></webview>


</template>

<script setup>

import Menu from "@/components/toolsMenu.vue"
import { ref, onMounted } from "vue"
import { useIpcRenderer } from "@vueuse/electron";
const ipcRenderer = useIpcRenderer();
const searchList = ref([])
onMounted(() => {
    let webview = document.querySelector("webview")
    webview.addEventListener("dom-ready", () => {
        //webview.openDevTools()
        // 打开nodeIntegration: true,
        //    contextIsolation: false,
        // 注入
        webview.executeJavaScript(`
            document.getElementsByClassName("page_pc_top")[0].remove()
            document.getElementsByClassName("page_pc_cer")[0].remove()
            document.getElementsByClassName("footer")[0].remove()
            // 监听所有a标签的点击事件
            document.addEventListener('click', function(e) {
                let target = e.target;
                if (target && target.tagName === 'A') {
                    // 阻止a标签的默认跳转行为
                    e.preventDefault();
                    location.href = target.getAttribute('href')
                }
            }, false);
        `)
        webview.insertCSS(`
        `)
    })


})

</script>

<style scoped>
</style>